const mysql = require("mysql2");

const connection = mysql.createPool({
  hostname: "localhost",
  post: 3306,
  database: "coderhub",
  user: "root",
  password: "",
  connectionLimit: 10,
});

// 执行SQL语句
const statement = `SELECT * FROM products WHERE price > ? AND score > ?`;

// 使用连接池
// connection.execute(statement, [6000, 7], (err, results) => {
//   console.log(results);
// });

connection
  .promise()
  .execute(statement, [6000, 7])
  .then(([results]) => {
    console.log(results);
  })
  .catch((err) => {
    console.log(err);
  });
